package com.yehui.bean;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.SmartInstantiationAwareBeanPostProcessor;
import org.springframework.stereotype.Service;

import java.lang.reflect.Constructor;

@Service
public class MySmartInstantiationAwareBeanPostProcessor implements SmartInstantiationAwareBeanPostProcessor {
    //预测bean的类型最后一次改变组件的类型
    @Override
    public Class<?> predictBeanType(Class<?> beanClass, String beanName) throws BeansException {
        System.out.println("MySmartInstantiationAwareBeanPostProcessor predictBeanType()==============");
        return null;
    }

    public MySmartInstantiationAwareBeanPostProcessor(){
        System.out.println("MySmartInstantiationAwareBeanPostProcessor================");
    }

    //返回我们要使用的构造器列表
    @Override
    public Constructor<?>[] determineCandidateConstructors(Class<?> beanClass, String beanName) throws BeansException {
        System.out.println("determineCandidateConstructors");
        //返回一个无指定的构造器
        return null;
    }

    //获取早期的bean引用
    @Override
    public Object getEarlyBeanReference(Object bean, String beanName) throws BeansException {
        return null;
    }
}
